<?php
/**
 * @Copyright Copyright (C) 2010-2012
 * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
 + Created by:          Webit Solution
 * Company:		Webit Solution
 + Contact:		www.webits.asia, developer@webits.asia
 * Created on:	Mar 21, 2012
 ^
 + Project: 		WRecruit
 * File Name:	views/jobseeker/tmpl/myresume.php
 ^ 
 * Description: template view for my resume
 ^ 
 * History:		NONE
 ^ 
 */
 
 defined('_JEXEC') or die('Restricted access');

 global $mainframe;
 $document =& JFactory::getDocument();
 $document->addStyleSheet('components/com_wrecruit/css/'.$this->config['theme']);

 $link = "index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=myresumes&Itemid=".$this->Itemid;
 $resumecatlink = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=jobcat&Itemid='.$this->Itemid;
?>
<script language=Javascript>
    function confirmdeleteresume(){
        return confirm("<?php echo JText::_('JS_ARE_YOU_SURE_DELETE_THE_RESUME'); ?>");
    }
</script>
<?php if ($this->config['offline'] == '1'){ ?>
<table cellpadding="0" cellspacing="0" border="0" width="100%" >
	<tr><td valign="top" class="<?php echo $this->theme['title']; ?>" >	<?php echo $this->config['title']; ?></td></tr>
	<tr><td height="25"></td></tr>
	<tr><td class="wrecruitmsg">
		<?php echo $this->config['offline_text']; ?>
	</td></tr>
</table>	
<?php }else{ ?>

<table cellpadding="0" cellspacing="0" border="0" width="100%" >
	<tr><td valign="top" class="<?php echo $this->theme['title']; ?>" >	
		<?php echo $this->config['title']; ?>
	</td>
	</tr>
	<tr><td height="23"></td></tr>
	<?php if ($this->config['cur_location'] == 1) {?>
	<tr><td height="0"></td></tr>
	<tr><td class="curloc">
		<?php echo JText::_('JS_CUR_LOC'); ?> : <?php echo JText::_('JS_MY_RESUME'); ?>
	</td></tr>
	<?php } ?>
	<tr><td>
		<?php 
			$cutomlink = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=formresume&vm=2&Itemid='.$this->Itemid;
			$cutomlinktext = JText::_('JS_ADD_RESUME');
			$count = 0;
			if (sizeof($this->jobseekerlinks) != 0){
				echo '<div id="toplinks"><ul>';
				foreach($this->jobseekerlinks as $lnk)	{ 
				 if ($this->config['tmenu_jsaddresume'] == 1) {
					if ($count == 1) { ?>
						<span>
							<a href="<?php echo $cutomlink; ?>"> <?php echo $cutomlinktext; ?></a>
						</span>
					<?php }	?>
					<?php }	?>
					<span <?php if($lnk[2] == 1)echo 'class="first"'; elseif($lnk[2] == -1)echo 'class="last"';  ?>>
						<a href="<?php echo $lnk[0]; ?>"> <?php echo $lnk[1]; ?></a>
					</span>
				<?php $count++;	
				}
				echo '<ul></div>';			
			} 
	?>
	</td></tr>	
	<tr><td height="3"></td></tr>
	<tr><td class="<?php echo $this->theme['heading']; ?>" align="center">
		<?php echo JText::_('JS_MY_RESUME'); ?>  
	</td></tr>
	<tr><td height="3"></td></tr>
</table>

<?php
		if ($this->resumes){

if ($this->userrole->rolefor == 2) { // job seeker

	if ($this->sortlinks['sortorder'] == 'ASC')
		$img = "components/com_wrecruit/images/sort0.png";
	else
		$img = "components/com_wrecruit/images/sort1.png";
?>
	<form action="index.php" method="post" name="adminForm">
	<table cellpadding="0" cellspacing="0" border="0" width="100%" >
		<tr class="<?php echo $this->theme['sortlinks']; ?>">
			<td class="<?php echo $this->theme['sortlinks']; ?>"  valign="center" align="center">&nbsp;&nbsp;<strong><?php echo JText::_('JS_SORT_BY'); ?> : </strong> 
				&nbsp;&nbsp;&nbsp;<strong><a class="<?php echo $this->theme['sortlinks']; ?>" href="<?php echo $link?>&sortby=<?php echo $this->sortlinks['application_title']; ?>"><?php echo JText::_('JS_TITLE'); ?></a></strong><?php if ($this->sortlinks['sorton'] == 'application_title') { ?> <img src="<?php echo $img ?>"> <?php } ?>
				&nbsp;&nbsp;|&nbsp;&nbsp;<strong><a class="<?php echo $this->theme['sortlinks']; ?>" href="<?php echo $link?>&sortby=<?php echo $this->sortlinks['jobtype']; ?>"><?php echo JText::_('JS_JOBTYPE'); ?></a></strong><?php if ($this->sortlinks['sorton'] == 'jobtype') { ?> <img src="<?php echo $img ?>"> <?php } ?>
				&nbsp;&nbsp;|&nbsp;&nbsp;<strong><a class="<?php echo $this->theme['sortlinks']; ?>" href="<?php echo $link?>&sortby=<?php echo $this->sortlinks['salaryrange']; ?>"><?php echo JText::_('JS_SALARY_RANGE'); ?></a></strong><?php if ($this->sortlinks['sorton'] == 'salaryrange') { ?> <img src="<?php echo $img ?>"> <?php } ?>
				&nbsp;&nbsp;|&nbsp;&nbsp;<strong><a class="<?php echo $this->theme['sortlinks']; ?>" href="<?php echo $link?>&sortby=<?php echo $this->sortlinks['created']; ?>"><?php echo JText::_('JS_DATEPOSTED'); ?></a></strong><?php if ($this->sortlinks['sorton'] == 'created') { ?> <img src="<?php echo $img ?>"> <?php } ?>
			</td>
		</tr>
                </table>
      <?php if ( $this->resumestyle['search_resume_style'] == 'classic' ) { ?>

                <table cellpadding="0" cellspacing="0" border="0" width="100%">
                <?php 
		$tdclass = array($this->theme['odd'], $this->theme['even']);
		$isnew = date("Y-m-d H:i:s", strtotime("-$this->config['newdays'] days"));
		//$tdclass = array("odd", "even");
		$isodd =1;
		foreach($this->resumes as $resume)	{ 
		$isodd = 1 - $isodd; ?>
		<tr height="20" class="<?php echo $tdclass[$isodd]; ?>" > <td colspan="5">
			<table cellpadding="0" cellspacing="0" border="0" width="100%">
				<tr><td height="3"></td></tr>
				<tr>
					<td >&nbsp;<strong><?php echo JText::_('JS_TITLE'); ?>	</strong></td>
					<td  colspan="3"><?php echo $resume->application_title;	?></td>
				</tr>
				<tr>
					<td  width="20%">&nbsp;<strong><?php echo JText::_('JS_JOB_CATEGORY'); ?>	</strong></td>
					<td  width="20%"><?php echo $resume->cat_title;//value -1 for array index ?></td>
					<td >&nbsp;<strong><?php echo JText::_('JS_SALARY_RANGE'); ?>	</strong></td>
					<td ><?php $salary = $this->config['currency'] . $resume->rangestart . ' - ' . $this->config['currency'] . $resume->rangeend . JText::_('JS_PERMONTH');
									echo $salary; ?></td>
				</tr>
				<tr>
					<td  width="20%">&nbsp;<strong><?php echo JText::_('JS_JOBTYPE'); ?>	</strong></td>
					<td  width="30%"><?php echo $resume->jobtypetitle;?></td>
					<td  width="20%">&nbsp;<strong><?php echo JText::_('JS_EMAIL'); ?>	</strong></td>
					<td  width="30%"><?php echo $resume->email_address; ?></td>
				</tr>
				<tr>
					<td >&nbsp;<strong><?php echo JText::_('JS_CREATED'); ?>	</strong></td>
					<td ><?php echo date($this->config['date_format'],strtotime($resume->create_date)); ?></td>
					<td >&nbsp;</td>
					<td ></td>
				</tr>
					<tr>
                                             <td height="35" colspan="4" align="center">
                                                <table><tr>

                                                    <td  align="center" >
                                                        <?php $link = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=formresume&vm=1&rd='.$resume->id.'&Itemid='.$this->Itemid; ?>
                                                        <a class="" href="<?php echo $link?>" title="<?php echo JText::_('JS_EDIT'); ?>"><img width="17" height="17" src="components/com_wrecruit/images/edit.png" /></a>
                                                        &nbsp;&nbsp;&nbsp;
                                                        <?php $link = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=view_resume&vm=1&rd='.$resume->id.'&Itemid='.$this->Itemid; ?>
                                                        <a class="" href="<?php echo $link?>" title="<?php echo JText::_('JS_VIEW'); ?>"><img width="17" height="17" src="components/com_wrecruit/images/view.png" /></a>
                                                        &nbsp;&nbsp;&nbsp;
            						<?php $link = 'index.php?option=com_wrecruit&c=wrecruit&task=deleteresume&rd='.$resume->id.'&Itemid='.$this->Itemid; ?>
							<a href="<?php echo $link?>" onclick=" return confirmdeleteresume();" class="" title="<?php echo JText::_('JS_DELETE'); ?>"><img width="17" height="17" src="components/com_wrecruit/images/delete.png" /></a>
                                                        &nbsp;&nbsp;&nbsp;
                                                        <?php if ($resume->status == '0') {?>
                                                                <?php echo '<span class="jobstatusmsg">'.JText::_('JS_STATUS') .' : ' . JText::_('JS_APPROVALWAITING').'</span>'; ?>
                                                        <?php }elseif ($resume->status == '-1') {?>
                                                                <?php echo '<span class="jobstatusmsg">'.JText::_('JS_STATUS') .' : ' . JText::_('JS_NOTAPPROVED').'</span>'; ?>
                                                        <?php }elseif ($resume->status == '1') {?>
                                                        <?php $link = JRoute::_('index.php?option=com_wrecruit&c=wrecruit&task=addtogoldresumes&rd='.$resume->id.'&Itemid='.$this->Itemid); ?>
                                                        <a href="<?php echo $link?>" class="" title="<?php echo JText::_('JS_ADD_TO_GOLD_RESUMES'); ?>"><img width="17" height="17" src="components/com_wrecruit/images/add_gold.png" /></a>
                                                        &nbsp;&nbsp;&nbsp;
                                                        <?php $link = JRoute::_('index.php?option=com_wrecruit&c=wrecruit&task=addtofeaturedresumes&rd='.$resume->id.'&Itemid='.$this->Itemid); ?>
                                                        <a href="<?php echo $link?>" class="" title="<?php echo JText::_('JS_ADD_TO_FEATURED_RESUMES'); ?>"><img width="17" height="17" src="components/com_wrecruit/images/add_featured.png" /></a>
                                                        &nbsp;&nbsp;&nbsp;
                                                        </td>                                                    <?php } ?>
                                                </tr></table>

                                             </td>
					</tr>
			</table>	
		</td></tr>
		<?php
		}
		 ?>		
	</table>
            <?php  }elseif ( $this->resumestyle['search_resume_style'] == 'july2011' ){ ?>

                <table cellpadding="0" cellspacing="0" border="0" width="100%">
                <?php
		$tdclass = array($this->theme['odd'], $this->theme['even']);
		$isnew = date("Y-m-d H:i:s", strtotime("-$this->config['newdays'] days"));
		//$tdclass = array("odd", "even");
		$isodd =1;
		foreach($this->resumes as $resume)	{
                $comma = "";
		$isodd = 1 - $isodd; ?>
		<tr height="20" class="<?php echo $tdclass[$isodd]; ?>" > <td colspan="5">
			<table cellpadding="0" cellspacing="0" border="0" width="100%">
                            <div class="wrecruit_resumetop">
                                <span class="wrecruit_titlestyle" ><?php echo $resume->first_name.' '.$resume->last_name ?></span>
                                <span  class="wrecruit_titlelocationset"> <?php echo ''. $resume->application_title; ?> </span>
                                <span class="wrecruit_addresslocationset">
                                    <strong>
                                    <?php echo JText::_('JS_ADDRESS'); ?></strong>
                                        <?php if($resume->cityname != '') { ?>
                                            <?php echo $comma.$resume->cityname; $comma = " ," ; ?>
                                        <?php } elseif($resume->employer_city != ''){ ?>
                                            <?php echo $comma.$resume->employer_city; $comma = " ," ; ?>
                                        <?php } ?>

                                        <?php if($resume->countyname != '') { ?>
                                            <?php echo $comma.$resume->countyname; $comma = " ," ; ?>
                                        <?php } elseif($resume->employer_county != ''){ ?>
                                            <?php echo $comma.$resume->employer_county; $comma = " ," ; ?>
                                        <?php } ?>
                                        <?php if($resume->statename != '') { ?>
                                            <?php echo $comma.$resume->statename; $comma = " ," ; ?>
                                        <?php }elseif($resume->employer_state != ''){ ?>
                                            <?php echo $comma.$resume->employer_state; $comma = " ,"; ?>
                                        <?php } ?>
                                        <?php if($resume->countryname != '') { ?>
                                            <?php echo $comma.$resume->countryname; ?>
                                        <?php } ?>
                                </span>
                            </div>
                            <div class="wrecruit_resumeimg">
                                <?php if($resume->photo != '') { ?>
                                    <img  src="<?php echo $this->config['data_directory'];?>/data/jobseeker/resume_<?php echo $resume->id ; ?>/photo/<?php echo $resume->photo ; ?>" width="150px" height="150px" title="picture"  alt="Resume Photo"/>
                                <?php } ?>
                            </div>
                            <div class="wrecruit_resumeworkexp">
                                <span class="wrecruit_titlestylewx"><?php echo JText::_('JS_WORK_EXPERIENCE').'<br>'; ?></span>
                                    <?php echo $resume->employer_position.'<br>'; ?>
                                    <?php echo $resume->employer.'<br>'; ?>
                                    <?php echo $resume->employer_resp.'<br>'; ?>
                                    <?php echo $resume->employer_from_date.' To '.$resume->employer_to_date.'<br>'; ?>
                                    <?php echo $resume->employer_address.'<br>'; ?>

                            </div>
                            <div class="wrecruit_resumeinfo">
                                <?php echo $resume->cat_title.'<br>';//value -1 for array index ?>
                                <?php $salary = $resume->symbol. $resume->rangestart . ' - ' . $resume->symbol . $resume->rangeend .' '. JText::_('JS_PERMONTH');
                                echo $salary.'<br>'; ?>
                                <?php echo $resume->jobtypetitle.'<br>';?>
                                <?php echo $resume->email_address.'<br>'; ?>
                                <?php echo date($this->config['date_format'],strtotime($resume->create_date)); ?>

                            </div>
                            <div class="wrecruit_resumebottom">
                                        <?php $link = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=formresume&vm=1&rd='.$resume->id.'&Itemid='.$this->Itemid; ?>
                                        <a class="" href="<?php echo $link?>" title="<?php echo JText::_('JS_EDIT'); ?>"><img width="17" height="17" src="components/com_wrecruit/images/edit.png" /></a>
                                        &nbsp;&nbsp;&nbsp;
                                        <?php $link = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=view_resume&vm=1&rd='.$resume->id.'&Itemid='.$this->Itemid; ?>
                                        <a class="" href="<?php echo $link?>" title="<?php echo JText::_('JS_VIEW'); ?>"><img width="17" height="17" src="components/com_wrecruit/images/view.png" /></a>
                                        &nbsp;&nbsp;&nbsp;
                                        <?php $link = 'index.php?option=com_wrecruit&c=wrecruit&task=deleteresume&rd='.$resume->id.'&Itemid='.$this->Itemid; ?>
                                        <a href="<?php echo $link?>" onclick=" return confirmdeleteresume();" class="" title="<?php echo JText::_('JS_DELETE'); ?>"><img width="17" height="17" src="components/com_wrecruit/images/delete.png" /></a>
                                        &nbsp;&nbsp;&nbsp;
                                        <?php if ($resume->status == '0') {?>
                                                <?php echo '<span class="jobstatusmsg">'.JText::_('JS_STATUS') .' : ' . JText::_('JS_APPROVALWAITING').'</span>'; ?>
                                        <?php }elseif ($resume->status == '-1') {?>
                                                <?php echo '<span class="jobstatusmsg">'.JText::_('JS_STATUS') .' : ' . JText::_('JS_NOTAPPROVED').'</span>'; ?>
                                        <?php }elseif ($resume->status == '1') {?>
                                            <?php $link = JRoute::_('index.php?option=com_wrecruit&c=wrecruit&task=addtogoldresumes&rd='.$resume->id.'&Itemid='.$this->Itemid); ?>
                                            <a href="<?php echo $link?>" class="" title="<?php echo JText::_('JS_ADD_TO_GOLD_RESUMES'); ?>"><img width="17" height="17" src="components/com_wrecruit/images/add_gold.png" /></a>
                                            &nbsp;&nbsp;&nbsp;
                                            <?php $link = JRoute::_('index.php?option=com_wrecruit&c=wrecruit&task=addtofeaturedresumes&rd='.$resume->id.'&Itemid='.$this->Itemid); ?>
                                            <a href="<?php echo $link?>" class="" title="<?php echo JText::_('JS_ADD_TO_FEATURED_RESUMES'); ?>"><img width="17" height="17" src="components/com_wrecruit/images/add_featured.png" /></a>
                                            &nbsp;&nbsp;&nbsp;
                                        <?php } ?>


                            </div>
			</table>
		</td></tr>
		<?php
		}
		 ?>
	</table>




         <?php    } ?>
	<input type="hidden" name="option" value="<?php echo $this->option; ?>" />
			<input type="hidden" name="task" value="deleteresume" />
			<input type="hidden" id="id" name="id" value="" />
			<input type="hidden" name="boxchecked" value="0" />

	</form>

	<form action="<?php echo JRoute::_('index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=myresumes&Itemid='.$this->Itemid); ?>" method="post">
	<table cellpadding="0" cellspacing="0" border="0" width="100%" >
    <tr>
        <td></td>
        <td >
            <?php
            echo $this->pagination->getPagesLinks();
            ?>
        </td>
    </tr>
    <tr>
        <td align="left">
            <?php echo JText::_('JS_DISPLAY_#'); ?>
            <?php
            echo $this->pagination->getLimitBox();
            ?>
        </td>
        <td align="right">
            <?php
            echo $this->pagination->getResultsCounter();
            ?>
        </td>
    </tr>
	</table>
	</form>	
<?php

} else{ // not allowed job posting
	//Update by Vireak on 09/08/2012
	//Add frame to this warning and some styling
	//---------------------
	echo '<div class="box-list"><div class="head-title"><h2>Oop!</h2></div>';
	echo '<span class="wr_info"><p>'.JText::_('JS_YOU_ARE_NOT_ALLOWED_TO_VIEW').'</p>';
	echo '<p>This page is reserved for the authorized candidates only. </p></span>';
	echo '</div>';
	//---------------------
}	
}else{ // no result found in this category
	echo JText::_('JS_RESULT_NOT_FOUND');
}
}//ol
?>	

<div width="100%">
<?php 
if($this->config['fr_cr_txsh']) {
	echo 
	'<table width="100%" style="table-layout:fixed;">
		<tr><td height="15"></td></tr>
		<tr><td style="vertical-align:top;" align="center">'.$this->config['fr_cr_txa'].$this->config['fr_cr_txb'].'</td></tr>
	</table>';
}	
?>
</div>
